POST: http://www.nomedoseusite.com.br/api_products_others.php?action=add_pack
Header Parameter | Format |
Usuario1 | base64_encode() |
Senha1 | base64_encode() |
Parameter | Format | Description |
name | JSON |
Main name of pack |
comprimento | JSON | Length of pack Only number is required Example: 16 Format: int(4) * FIELD REQUIRED |
altura | JSON | Height of pack Only number is required Example: 11 Format: int(4) * FIELD REQUIRED |
largura | JSON | Width of pack Only number is required Example: 20 Format: int(4) * FIELD REQUIRED |
PHP Sample
// sample add packages $url = $domain_url . '/api_products_others.php?action=add_pack'; $data = array("name" => "Main name of pack", // Main name of pack * FIELD REQUIRED "comprimento" => "Length of pack", // Length of pack * FIELD REQUIRED "altura" => "Height of pack", // Height of pack * FIELD REQUIRED "largura" => "Width of pack" // Width of pack * FIELD REQUIRED ); $data_string = json_encode($data); $ch = curl_init($url); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', "Cache-Control: no-cache", 'Usuario1: ' . base64_encode($usuario1), 'Senha1: ' . base64_encode($senha1), 'Content-Length: ' . strlen($data_string)) ); $result = curl_exec($ch); curl_close($ch); print_r($result); // sample add packages eof
Return Error:
code
message
Return Success:
code
id
message